40823220 cd2021

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • WORKS
    • stage1
      • 1
      • 2~3
      • 4
      • 5
    • stage2
      • 6~7
      • 8
      • 9
    • stage3
      • 10
      • 10-task1
      • 10~11 task2
      • 12
      • 13
      • 14~15 機械手臂控制
      • 16
  • 筆記
    • SSH
    • 協同push遇到的問題
    • 推送內容給小組的步驟
    • task1亂數分組 操作步驟
    • GOGS倉儲clone及推送方式
  • 每週影片區
    • w1
    • w2~w3
    • w4
    • w6~w7
    • w8
    • w9
    • w10
    • w11
    • w12~w13
    • w13
    • w14
    • w15~w16
  • w5
  • W15
  • W16
  • W18
10-task1 << Previous Next >> 12

10~11 task2

(更新)升降梯後來有成功做出來,成果影片在w14

(更新)搬運機有成功做出來,成果影片在w15

1.利用api來控制我們stage1的產品,但是因為我們之前沒有成功模擬出來,所以也沒有達到完全控制

2.stage2的產品還在測試中

3.錄製影片,放在每周影片區,順便秀一下stage3的產品

升降梯程式:

程式:

# File created by Thibaut Royer, Epitech school
# thibaut1.royer@epitech.eu
# It intends to be an example program for the "Two wheels, one arm" educative project.

import sim as vrep
import math
import random
import time
#import keyboard


print ('Start')

# Close eventual old connections
vrep.simxFinish(-1)
# Connect to V-REP remote server
clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 5000, 5)

if clientID != -1:
    print ('Connected to remote API server')
    
    res = vrep.simxAddStatusbarMessage(
        clientID, "40823220",
        vrep.simx_opmode_oneshot)
    if res not in (vrep.simx_return_ok, vrep.simx_return_novalue_flag):
        print("Could not add a message to the status bar.")

    
    opmode = vrep.simx_opmode_oneshot_wait
    

    
    vrep.simxStartSimulation(clientID, opmode)
    ret,front_handle=vrep.simxGetObjectHandle(clientID,"joint0",opmode)
    ret,left_handle=vrep.simxGetObjectHandle(clientID,"joint",opmode)
    ret,right_handle=vrep.simxGetObjectHandle(clientID,"joint2",opmode)
    vrep.simxSetJointTargetVelocity(clientID,left_handle,10,opmode)
    #vrep.simxGetObjectHandle(clientID, "main", opmode)

        
        
else:
    print ('Failed connecting to remote API server')
    print ('End')

搬運機程式:

import sim as vrep
import math
import random
import time
import keyboard
  
print ('Start')
  
# Close eventual old connections
vrep.simxFinish(-1)
# Connect to V-REP remote server
clientID = vrep.simxStart('192.168.50.217', 19997, True, True, 5000, 5)
   
if clientID !=-1:
    print ('Connected to remote API server')
    
    res = vrep.simxAddStatusbarMessage(
        clientID, "40823204",
        vrep.simx_opmode_oneshot)
           
    if res not in (vrep.simx_return_ok, vrep.simx_return_novalue_flag):
        print("Could not add a message to the status bar.")
           
    opmode = vrep.simx_opmode_oneshot_wait
    STREAMING = vrep.simx_opmode_streaming
      
    vrep.simxStartSimulation(clientID, opmode)
     
     
    ret,fwheel_handle=vrep.simxGetObjectHandle(clientID,"joint0",opmode)
    ret,bwheel_handle=vrep.simxGetObjectHandle(clientID,"joint2",opmode)
    ret,pole1_handle=vrep.simxGetObjectHandle(clientID,"joint3",opmode)
    ret,pole2_handle=vrep.simxGetObjectHandle(clientID,"joint4",opmode)
    ds=0
    dy=0
    df=0
    db=0
    vrep.simxSetJointTargetPosition(clientID,fwheel_handle,df,opmode)
    vrep.simxSetJointTargetPosition(clientID,bwheel_handle,db,opmode)
    vrep.simxSetJointTargetPosition(clientID,pole1_handle,ds,opmode)
    vrep.simxSetJointTargetPosition(clientID,pole2_handle,dy,opmode)
     
     
    while True:
        #Clockwise
        if keyboard.is_pressed("2"):
            ds=ds-0.01
            dy=dy-0.01
            vrep.simxSetJointTargetPosition(clientID,pole1_handle,ds,opmode)
            vrep.simxSetJointTargetPosition(clientID,pole2_handle,dy,opmode)
            print("up")
        if keyboard.is_pressed("4"):
            ds=ds+0.01
            dy=dy+0.01
            vrep.simxSetJointTargetPosition(clientID,pole1_handle,ds,opmode)
            vrep.simxSetJointTargetPosition(clientID,pole2_handle,dy,opmode)
            print("down")
        if keyboard.is_pressed("6"):
            df=df+0.2
            db=db+0.2
            vrep.simxSetJointTargetPosition(clientID,fwheel_handle,df,opmode)
            vrep.simxSetJointTargetPosition(clientID,bwheel_handle,db,opmode)
            print("left")
        if keyboard.is_pressed("8"):
            df=df-0.2
            db=db-0.2
            vrep.simxSetJointTargetPosition(clientID,fwheel_handle,df,opmode)
            vrep.simxSetJointTargetPosition(clientID,bwheel_handle,db,opmode)
            print("right")
 
 
              
else:
    print ('Failed connecting to  remote API server')
    print ('End')


10-task1 << Previous Next >> 12

Copyright © All rights reserved | This template is made with by Colorlib